#include "TheirFreeKickBehaviour.h"


/*
 *	<POPIS>
 *
 */
bool TheirFreeKickBehaviour::Behave()
{
	Vector possibility1 = DATA_STORAGE.ballPosition -  Point(-36, -20.16f);
	Vector possibility2 = DATA_STORAGE.ballPosition -  Point(-36,  20.16f);
	
	if((possibility1.GetLength() < 1.5) || (possibility2.GetLength() < 1.5))
	{
		if(DATA_STORAGE.myUniform == 2)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX(), DATA_STORAGE.ballPosition.GetY() - 10), 2);
			return true;
		}
		else if(DATA_STORAGE.myUniform == 3)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 8, DATA_STORAGE.ballPosition.GetY() - 8), 2);
			return true;
		}
		else if(DATA_STORAGE.myUniform == 4)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 8, DATA_STORAGE.ballPosition.GetY() + 8), 2);
			return true;
		}
		else if(DATA_STORAGE.myUniform == 5)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 6, DATA_STORAGE.ballPosition.GetY() + 10), 2);
			return true;
		}
		return true;
	}
	else
	{
		if(DATA_STORAGE.myUniform == 5)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 8, DATA_STORAGE.ballPosition.GetY()), 2);
			return true;
		}
		else if(DATA_STORAGE.myUniform == 6)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 5, DATA_STORAGE.ballPosition.GetY() - 6), 2);
			return true;
		}
		else if(DATA_STORAGE.myUniform == 7)
		{
			GetRunToPositionBehaviour()->Behave(Point(DATA_STORAGE.ballPosition.GetX() - 6, DATA_STORAGE.ballPosition.GetY() - 4), 2);
			return true;
		}
	}
		
	DATA_STORAGE.ignoreBall = false;
	return false;
}
